.TH {telinit} 8
'''
.SH NAME
{telinit} \- pass commands to a running \fB{init}\fR(8) process.
'''
.SH SYNOPSIS
\fB{telinit}\fR \fIrunlevel\fR
.br
\fB{telinit}\fR {\fB?\fR|\fBq\fR|\fBstatus\fR|\fBreload\fR}
.br
\fB{telinit}\fR {\fBpoweroff\fR|\fBhalt\fR|\fBreboot\fR|\fBsleep\fR|\fBsuspend\fR}
.br
\fB{telinit}\fR {\fBstart\fR|\fBstop\fR} \fIname\fR [\fIname\fR ... ]
'''
.SH DESCRIPTION
The only way to contact a running init is via @initctl socket.
{telinit} does exactly that, providing also readable shortcuts
for raw init commands.
.P
Whatever output init may produce is passed to {telinit}'s stdout.
'''
.SH COMMANDS
.IP [0123456789]
Initiate a switch to specified runlevel.
.IP [+-][abcdef]
Activate/deactivate specified sublevel.
.IP "\fB?\fR, \fBlist\fR" 4
Request current status and process list from init.
.IP "\fBreload\fR" 4
Reload configuration.
.IP "\fBhalt\fR, \fBreboot\fR, \fBpoweroff\fR" 4
Stop the system, possibly requesting reboot or poweroff.
All three commands request a switch to runlevel 0, followed
by \fBreboot\fR(2) call with LINUX_REBOOT_CMD_HALT, LINUX_REBOOT_CMD_RESTART
or LINUX_REBOOT_CMD_POWER_OFF argument respectively.
.IP "\fBsleep\fR, \fBsuspend\fR" 4
Initiate a switch to runlevels 8 and 9 respectively.
For these commands to work properly, relevant actions must be configured
in inittab; init itself will not put the system to sleep.
.IP "\fBstart\fR \fIname\fR" 4
Start entry \fIname\fR. In case the entry is not configured to be started on
current runlevel, adjust its mask settings and start anyway.
.IP "\fBrestart\fR \fIname\fR" 4
Kill named process without changing its runlevel mask, forcing immediate respawn.
.IP "\fBstop\fR \fIname\fR" 4
Stop entry \fIname\fR.
This command marks the entry as disabled without changing runlevel mask.
.IP "\fBunstop\fR \fIname\fR" 4
Undo \fBstop\fR command without changing runlevel mask like \fBstart\fR does.
Depending on entry configuration, it may or may not be started immediately.
.IP "\fBpause\fR \fIname\fR, \fBresume\fR \fIname\fR" 4
Send SIGSTOP or SIGCONT to the process.
.IP "\fBhup \fIname\fR\fR" 4
Send SIGHUP to the process.
.IP "\fBpidof \fIname\fR\fR" 4
Print process id for the named entry.
.P
Wherever applicable, \fIname\fR is the first field from \fB{inittab}\fR(5) line,
or file basename in \fBinitdir\fR(5).
'''
.SH FILES
.IP {@initctl}
\fBunix\fR(7) domain socket {telinit} uses to contact init
'''
.SH CAVEATS
Runlevel change and process status change commands sent by {telinit}
are only executed after {telinit} has terminated the connection.
The only errors reported for these commands are those apparent immediately
by examining process record. Something like "named entry not found" will
be reported, but \fBexecve\fR(2) failure won't, at least not by {telinit}
(syslog will probably have it).
.P
Runlevel switch requests only start the move to another runlevel.
If some of the commands take long enough, it maybe be possible to see
init in-between runlevels with {telinit} q, and even change the target runlevel
before the switch is completed.
.P
On the other hand, {telinit} does wait for reconfiguration to finish before
exiting, and will show all configuration errors.
'''
.SH NOTES
This page describes {telinit} from \fB{INIT}\fR package.
Other init implementations may behave differently.
.P
In particular, this version of {telinit} is not compatible with sysvinit.
Most sysvinit options are not supported. Runlevel change and configuration
reload commands are same in both implementations however.
.P
Runlevel 0 is treated as a special case by {init}, prompting a reboot(2) call.
This is unlike sysvinit, for which "0 means halt" is merely a configuration
convention. On the other hand, runlevel 6 is not a special runlevel for {init},
and "{telinit} 6" will not reboot the system unless configuration explicitly
prompts so. Use "{telinit} reboot" instead.
'''
.SH SEE ALSO
\fB{init}\fR(8), \fB{inittab}\fR(5)
